<?php
namespace Admin\Controller;
use Think\Controller;
class PageController extends BackController {
	/**
	 * 初始化
	 */
	public function __construct() {
		parent::__construct();
	}

	/**
	 * 列表
	 */
    public function index() {
		$articleclass = D('article_class');
		$list = $articleclass->page(); 
		$this->assign('list',$list);
		$this->display();
    }

	/**
	 * 修改
	 */
	public function edit() {
		/*
		$_POST['content'] = '栏目222';
		$_POST['id'] = 5;
		*/

		if(IS_POST) {
			$id = I('post.id','','intval');
			$model = D('article_class');
			$msg = $model->editpage();
			if(!empty($msg)) {
				$this->success('操作成功！',U('Page/edit',array('id'=>$id)));
			} else {
				$this->error('操作失败！');
			}
			die();
		}
		
		$id = I('get.id','','intval');
		if(!empty($id)) {
			$info = D('article_class')->find();
			if(empty($info)) {
				die('not find this data');
			}
			$this->assign('info',$info);
		}

		$this->display();
	}

}
